package com.dup.jxlh.admin.mapper;

import com.dup.jxlh.admin.entities.auth.AuthInfo;
import com.dup.jxlh.admin.entities.auth.AuthPerm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigInteger;
import java.util.ArrayList;

@Mapper
public interface AuthMapper {
    @Select("select * from admin where phone = #{phone}")
    AuthInfo findByPhone(@Param("phone") String phone);

    @Select("select perm.* from perm " +
            "left join perm_role on perm_role.perm_id = perm.id " +
            "where perm_role.role_id = #{roleId}")
    ArrayList<AuthPerm> getAuthPerms(@Param("roleId") BigInteger roleId);
}
